package com.listeners;

import jakarta.servlet.annotation.WebListener;
import jakarta.servlet.http.*;

import java.util.Spliterator;
//@WebListener
public class ListenerSession implements HttpSessionListener, HttpSessionAttributeListener {
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        HttpSession session = se.getSession();
        System.out.println("session:"+session.getId()+"attribute:"+"iscreat");
    }


    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        HttpSession session = se.getSession();
        System.out.println("session:"+session.getId()+"attribute:"+"isdestroy");
    }
    @Override
    public void attributeAdded(HttpSessionBindingEvent se) {
        HttpSession session = se.getSession();
        System.out.println("session:"+session.getId()+"attribute:"+se.getName()+"value:"+se.getValue()+"iscreat");
    }
    @Override
    public void attributeRemoved(HttpSessionBindingEvent se) {
        HttpSession session = se.getSession();
        System.out.println("session:"+session.getId()+"attribute:"+se.getName()+"value:"+se.getValue()+"isremove");

    }

    @Override
    public void attributeReplaced(HttpSessionBindingEvent se) {
        HttpSession session = se.getSession();
        System.out.println("session:"+session.getId()+"attribute:"+se.getName()+"value:"+se.getValue()+"risreplaced");
    }

}
